package com.rdc.qingkou.presenter;


import com.rdc.qingkou.base.BasePresenterImpl;
import com.rdc.qingkou.model.PersonalHomepageModel;
import com.rdc.qingkou.presenter.ipresenter.IPersonalHomepagePresenter;
import com.rdc.qingkou.ui.iview.IPersonalHomepageView;
import com.rdc.qingkou.vo.CardVO;
import com.rdc.qingkou.vo.UserVO;

import java.util.List;

public class PersonalHomepagePresenter extends BasePresenterImpl<IPersonalHomepageView> implements IPersonalHomepagePresenter {

    private PersonalHomepageModel model;

    public PersonalHomepagePresenter() {
        model = new PersonalHomepageModel(this);
    }

    @Override
    public void getMyUserInfo() {
        model.getMyUserInfo();
    }

    @Override
    public void getMyUserInfoError(String message) {
        if (isAttachView()) {
            getMvpView().getMyUserInfoError(message);
        }
    }

    @Override
    public void getMyUserInfoSuccess(UserVO userVO) {
        if (isAttachView()) {
            getMvpView().setMyUserInfo(userVO);
        }
    }

    @Override
    public void getCards(int userId, int currentPage) {
        model.getCards(userId, currentPage);
    }

    @Override
    public void getCardSuccess(List<CardVO> list) {
        if (isAttachView()) {
            getMvpView().setCards(list);
        }
    }

    @Override
    public void getCardError(String message) {
        if (isAttachView()) {
            getMvpView().getCardError(message);
        }
    }

    @Override
    public void getStatusNum(int userId) {
        model.getStatusNum(userId);
    }

    @Override
    public void getStatusNumSuccess(int appreciate, int collectNum, int subscribeNum) {
        if (isAttachView()) {
            getMvpView().setStatusNum(appreciate, collectNum, subscribeNum);
        }
    }

    @Override
    public void getStatusNumError(String message) {
        if (isAttachView()) {
            getMvpView().getStatusNumError(message);
        }
    }

    @Override
    public void clearDisposable() {
        model.clearDisposable();
    }


}
